package com.sangengblog.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sangengblog.domain.entity.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 用户表(User)表数据库访问层
 *
 * @author makejava
 * @since 2024-02-26 22:33:47
 */
public interface UserMapper extends BaseMapper<User> {

    @Insert(value = "insert into sys_user_role values (#{userId}, #{roleId})")
    void addUserRole(@Param("userId") Long userId,@Param("roleId") Long roleId);

    @Select(value = "select * from sys_user_role where user_id=#{id}")
    List<Long> getUserRole(Long id);

    @Delete(value = "delete from sys_user_role where user_id=#{id}")
    void deleteUserRole(Long id);
}
